package test04.demo02.tx2;

public class MyRunnable implements Runnable {

    private int ticket = 50;

    @Override
    public void run() {
        while (true) {
            if (ticket < 0) {
                break;
            }
            String name = Thread.currentThread().getName();
            System.out.printf("%s 出售了第 %d 张电影票！%n", name, ticket);
            ticket -- ;
        }
    }
}
